package com.heyige.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

@Data
@Schema(description = "聊天历史相关数据传输对象")
public class ChatHistoryDto {

    @Setter
    @Getter
    @Schema(description = "聊天历史响应")
    public static class ChatHistoryResponse {
        @Schema(description = "聊天记录ID", example = "1")
        private Long id;
        
        @Schema(description = "用户ID", example = "1")
        private Long userId;
        
        @Schema(description = "会话ID", example = "session_123")
        private String sessionId;
        
        @Schema(description = "角色", example = "user")
        private String role;
        
        @Schema(description = "消息内容", example = "你好")
        private String content;
        
        @Schema(description = "使用的模型", example = "deepseek")
        private String model;
        
        @Schema(description = "消耗的token数量", example = "10")
        private Integer tokens;
        
        @Schema(description = "创建时间", example = "2024-01-01T12:00:00")
        private LocalDateTime createdAt;
    }

    @Setter
    @Getter
    @Schema(description = "会话响应")
    public static class SessionResponse {
        @Schema(description = "会话ID", example = "session_123")
        private String sessionId;
        
        @Schema(description = "最后一条消息", example = "你好")
        private String lastMessage;
        
        @Schema(description = "最后消息时间", example = "2024-01-01T12:00:00")
        private LocalDateTime lastMessageTime;
        
        @Schema(description = "消息数量", example = "5")
        private Integer messageCount;
    }

    @Setter
    @Getter
    @Schema(description = "统计信息响应")
    public static class StatisticsResponse {
        @Schema(description = "总消息数", example = "100")
        private Integer totalMessages = 0;
        
        @Schema(description = "总token数", example = "10000")
        private Integer totalTokens = 0;
        
        @Schema(description = "会话数量", example = "10")
        private Long sessionCount = 0L;
        
        @Schema(description = "第一条消息时间", example = "2024-01-01T10:00:00")
        private LocalDateTime firstMessageTime;
        
        @Schema(description = "最后一条消息时间", example = "2024-01-01T12:00:00")
        private LocalDateTime lastMessageTime;
    }

    @Setter
    @Getter
    @Schema(description = "清除请求")
    public static class ClearRequest {
        @Schema(description = "清除时间点", example = "2024-01-01T00:00:00")
        private LocalDateTime beforeTime;
    }
}